package com.aj.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import com.aj.entity.Article;
import com.aj.entity.TAddRequest;
import com.aj.entity.TDeleteRequest;
import com.aj.entity.Tag;
import com.aj.service.TagService;
import com.aj.util.Result;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author aj
 * @since 2020-08-03
 */
@RestController
@CrossOrigin(origins="http://localhost:8008")
@RequestMapping("/tag")
public class TagController {
	@Autowired
	TagService ts;
	
	@PostMapping("/getTagList")
	public Result getTag() {
		return ts.getTagList();
		
	}
	@PostMapping("/getTagByAid")
	public Result getTagByAid(@RequestBody Article a) {
		return ts.getTagByAid(a.getAid());
		
	}
	
	@PostMapping("/addTag")
	public Result addTag(@RequestBody TAddRequest t) {
		return ts.addTag(t);
		
	}
	@PostMapping("/deleteTag")
	public Result deleteTag(@RequestBody TDeleteRequest t) {
		return ts.deleteTag(t);
		
	}
	@PostMapping("/updateTag")
	public Result updateTag(@RequestBody Tag t) {
		return ts.updateTag(t);
		
	}

}
